Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Accessibility: Add checked/unchecked accessibility information to the "sort notes by" dialog #11411

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This pull request is a follow-up to #11395. Previously, TalkBack on Android did not read whether an item in the "sort notes by" dialog was checked/unchecked, making it difficult to determine the current sort order.

This pull request exposes the checked/unchecked state to accessibility tools through React Native's accessibilityState prop.

See also #11395, #10795.

Testing plan

Android 13:

  1. Enable TalkBack.
  2. Open the "Sort notes by" dialog.
  3. Verify that accessibility focus moves to the dialog.
  4. Move accessibility focus to the current sort method.
  5. Verify that TalkBack reads "checked", then the name of the sort method, then "Checked".
  6. Verify that TalkBack reads "not checked" for the other sort methods.
  7. Move accessibility focus to "reverse sort order".
    • For me, "reverse sort order" was checked and read as "checked, reverse sort order, checkbox"
  8. Double-tap.
  9. Verify that the dialog has closed and sort order has been reversed.


return (
<View style={styles.buttonContainer}>
<TouchableRipple
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request switches from a React Native Paper Button to a TouchableRipple. Unlike <Button>, TouchableRipple allows providing a custom accessibilityState. This allows communicating whether the button represents a checked/unchecked menu item.

On web, aria-checked seems necessary — react-native-web seems to ignore the accessibilityState's checked option.

@@ -112,6 +117,9 @@ function extraStyles(theme: BaseTheme) {
keyboardAppearance: theme.appearance,
color5: theme.color5 ?? theme.backgroundColor4,
backgroundColor5: theme.backgroundColor5 ?? theme.color4,

backgroundColorHover4: Color(theme.color4).alpha(0.12).rgb().string(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backgroundColorHover4 determines the ripple/hover color for the <TouchableRipple> menu item component. This use of Color matches how additional theme colors are added for the desktop app. For example,

const borderColor4: string = Color(theme.color).alpha(0.3);

Additionally, .alpha(0.12) should match React Native's <Button> hover color.

@personalizedrefrigerator personalizedrefrigerator added mobile All mobile platforms accessibility Related to accessibility labels Nov 18, 2024
@laurent22 laurent22 merged commit d648e43 into laurent22:dev Nov 20, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Related to accessibility mobile All mobile platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants